cmake_minimum_required(VERSION 3.0.0)

project(openplc)

option(WERROR "Set all warnings to errors" OFF)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -pthread")

execute_process(COMMAND ./iec2c.sh)

# Optional build capabilities
include_directories(lib/C)
include_directories(./)

# The main application that we always build
add_executable(openplc dnp3.cpp
                       enip.cpp
                       glueVars.cpp
                       interactive_server.cpp
                       main.cpp
                       modbus.cpp
                       modbus_master.cpp
                       pccc.cpp
                       persistent_storage.cpp
                       server.cpp
                       hardware_layers/coonix.cpp
                       Config0.o
                       Res0.o)

target_link_libraries(openplc rt)
target_link_libraries(openplc asiodnp3)
target_link_libraries(openplc openpal)
target_link_libraries(openplc opendnp3)
target_link_libraries(openplc asiopal)
target_link_libraries(openplc modbus)

install(TARGETS openplc DESTINATION bin)

